package pilgun.Multithread.Bank;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Account {
	private int balance;
	private ReentrantLock lock = new ReentrantLock();
	private Condition cond = lock.newCondition();
	private int id;
	public Account(int id, int balance) {
		this.balance = balance;
		this.id = id;
	}
	public void withdraw(int amount){
		balance-=amount;
	}
	public void deposit(int amount){
		balance+=amount;
	}
	public int getId(){
		return id;
	}
	public int getBalance() {
		return balance;
	}
	public ReentrantLock getLock(){
		return lock;
	}
	public Condition getCondition(){
		return cond;
	}
}
